package com.yonyou.pmclouds.basecom.conf;

import com.yonyou.iuap.tenant.utils.TenantSdkPropertyUtil;
import com.yonyou.pmclouds.basecom.condition.ExclusiveDeployCondition;
import com.yonyou.pmclouds.basecom.condition.PublicDeployCondition;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

@Configuration
public class DeployTypeConfiguration {
    public interface DeployInfo {
        String PUBLIC_DEPLOY = "public_deploy";
        String EXCLUSIVE_DEPLOY = "exclusive_deploy";

        String getDeployType();
    }

    @Conditional(PublicDeployCondition.class)
    @Component
    private static class PublicDeployInfo implements DeployInfo {

        @Override
        public String getDeployType() {
            return DeployInfo.PUBLIC_DEPLOY;
        }
    }

    @Conditional(ExclusiveDeployCondition.class)
    @Component
    private static class ExclusiveDeployInfo implements DeployInfo {

        @Override
        public String getDeployType() {
            return DeployInfo.EXCLUSIVE_DEPLOY;
        }
    }

    public static String getSysId() {
        return TenantSdkPropertyUtil.getPropertyByKey("sysid");

    }
}

